package lab1;

public class Test05 {
    public static void main(String[] args) {
        //for循环做1加到100
        int sum = 0;
        for (int i = 1; i <= 100; i++) {

            sum += i;
        }
        System.out.println("sum=" + sum);


        //while循环做1加到100
        int sum1 = 0;
        int i = 1;
        while (i <= 100) {
            sum1 += i;
            i++;
        }
        System.out.println("sum1=" + sum1);


        //do while循环1加到100
        int j = 1;
        int sum2 = 0;
        do {
            sum2 = sum2 + j;
            j++;
        } while (j < 101);
        System.out.println("sum2=" + sum2);

    }
}
